<?php
/**
 * Created by PhpStorm.
 * User: wangsentao
 * Date: 2018/2/2
 * Time: 下午4:24
 */

namespace app\common\Cache;

use app\common\Utils\RedisClient;

class CAdminUser
{
    const PREFIX = 'Oauth:AdminUser:%d';

    public static $expires = 72000;

    public static function cacheUser($info)
    {
        $redis = new RedisClient();
        $index_key = sprintf(self::PREFIX, $info['acc_id']);
        $redis->hMSet($index_key, $info);
        $redis->setExpire($index_key, self::$expires);
        return true;
    }

    /**
     * 获取超管用户缓存的信息
     * @param $acc_id
     * @return \app\common\Utils\返回值
     */
    public static function getHotUserInfo($acc_id)
    {
        $redis = new RedisClient();
        $index_key = sprintf(self::PREFIX, $acc_id);
        return $redis->hGetAll($acc_id);
    }

}